package com.shicijiaoliu.mapper;

import com.shicijiaoliu.pojo.Active;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface Activemapper {

    int getcount(String name, LocalDateTime starttime, LocalDateTime endtime);

    List<Active> findBypage(String name, LocalDateTime starttime, LocalDateTime endtime);

    @Select("select * from active where name=#{name}")
    Active findByname(String name);

    @Delete("delete from active where id=#{id}")
    void delByid(long id);

    @Insert("insert into active (name, description, a_id, bi, starttime, endtime) " +
            " value (#{name},#{description},#{aId},#{bi},#{starttime},#{endtime})")
    void add(Active active);

    @Select("select * from active where id=#{id}")
    Active findByid(long id);

    @Update("update active set name=#{name},description=#{description},a_id=#{aId},bi=#{bi},starttime=#{starttime},endtime=#{endtime} where id=#{id}")
    void update(Active active);

    @Select("select * from active")
    List<Active> getlist();
}
